<template>
  <div class="header">
    <div class="avatar">
      <img :src="seller.avatar" alt />
    </div>
    <div class="content">
      <div class="title">
        <span class="brand"></span>
        <h3>{{seller.name}}</h3>
      </div>
      <div class="description">
        <span>{{seller.description}} / {{seller.deliveryTime}}分钟送达</span>
      </div>
      <div class="support" v-if="seller.supports">
        <span class="icon" :class="classMap[seller.supports[0].type]"></span>
        <span class="text">{{seller.supports[0].description}}</span>
        <button class="more" @click.prevent="isDetail = true">
          <span>{{seller.supports.length}}个</span>
          <span class="icon-keyboard_arrow_right incofont"></span>
        </button>
      </div>
    </div>
    <div class="head-bottom" @click="isDetail = true">
      <span class="icon"></span>
      <span class="text">{{seller.bulletin}}</span>
      <span class="icon-keyboard_arrow_right incofont"></span>
    </div>
    <div class="bg">
      <img :src="seller.avatar" />
    </div>
    <transition name="fade">
      <v-detail @closeDetail="isDetail = false" v-show="isDetail" :seller="seller"></v-detail>
    </transition>
  </div>
</template>
<script>
import detail from './Detail'
export default {
  props: ['seller'],
  data() {
    return {
      isDetail: false,
      classMap: ['decrease', 'discount', 'guarantee', 'invoice', 'special']
    }
  },
  components: {
    'v-detail': detail
  },
  created() {
    // this.getInfo()
  },
  methods: {}
}
</script>
<style lang="stylus" scoped>
@import '../../assets/stylus/mixin.styl';

.header {
  position: relative;
  height: 2.68rem;
  width: 100%;
  border-bottom: 1px solid #ccc;
  padding: 0.48rem 0.24rem 0.56rem 0.48rem;
  margin-right: 0.32rem;
  display: flex;
  background-color: rgba(7, 17, 27, 0.5);
  box-sizing: border-box;
  overflow: hidden;

  .avatar {
    margin-right: 0.32rem;

    img {
      dispaly: block;
      height: 1.28rem;
      width: 1.28rem;
      border-radius: 0.05rem;
    }
  }

  .content {
    height: 1.28rem;
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: space-between;

    .title {
      display: flex;
      align-items: center;

      .brand {
        display: block;
        margin-right: 0.12rem;
        width: 0.6rem;
        height: 0.36rem;
        bg-img('../../assets/imgs/brand');
        background-repeat: no-repeat;
        background-size: 0.6rem 0.36rem;
      }

      h3 {
        font-size: 0.32rem;
        color: #fff;
        font-weight: 700;
        line-height: 0.32rem;
      }
    }

    .description {
      font-size: 0.24rem;
      color: #fff;
      line-height: 0.24rem;
    }

    .support {
      // line-height: 0.48rem;
      position: relative;

      .icon {
        display: inline-block;
        width: 0.24rem;
        height: 0.24rem;
        vertical-align: middle;
        background-repeat: no-repeat;
        background-size: 0.24rem;

        &.decrease {
          bg-img('../../assets/imgs/decrease_1');
        }

        &.discount {
          bg-img('../../assets/imgs/discount_1');
        }

        &.guarantee {
          bg-img('../../assets/imgs/guarantee_1');
        }

        &.invoice {
          bg-img('../../assets/imgs/invoice_1');
        }

        &.special {
          bg-img('../../assets/imgs/special_1');
        }
      }

      .text {
        margin-left: 0.08rem;
        font-size: 0.2rem;
        color: #fff;
        line-height: 0.2rem;
      }

      .more {
        position: absolute;
        bottom: 50%;
        right: 0;
        transform: translateY(50%);
        text-align: center;
        padding: 0 0.16rem;
        border-radius: 0.24rem;
        color: #fff;
        background-color: rgba(0, 0, 0, 0.2);
        height: 0.48rem;
        line-height: 0.48rem;
        font-size: 0.2rem;

        .incofont {
          vertical-align: middle;
        }
      }
    }
  }

  .head-bottom {
    height: 0.56rem;
    line-height: 0.56rem;
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 0 0.44rem 0 0.24rem;
    background-color: rgba(7, 17, 27, 0.2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    color: #fff;

    .icon {
      display: inline-block;
      bg-img('../../assets/imgs/bulletin');
      background-size: 0.44rem 0.24rem;
      background-repeat: no-repeat;
      width: 0.44rem;
      height: 0.24rem;
      vertical-align: middle;
    }

    .text {
      margin: 0 0.08rem;
      font-size: 0.2rem;
    }

    .incofont {
      position: absolute;
      right: 0.16rem;
      top: 50%;
      transform: translateY(-50%);
    }
  }

  .bg {
    position: absolute;
    top: 0%;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(10px);
    z-index: -1;

    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
